<?php
$params = array_merge(
    require __DIR__ . '/../../common/config/params.php',
    require __DIR__ . '/../../common/config/params-local.php',
    require __DIR__ . '/params.php',
    require __DIR__ . '/params-local.php'
);

return [
    'id' => 'app-api',
    'basePath' => dirname(__DIR__),
    'controllerNamespace' => 'api\controllers',
    'bootstrap' => ['log'],
    'modules' => [],
    'components' => [
        'mongodb'=>[
            'class' => 'yii\mongodb\Connection',
            'dsn' => 'mongodb://username:pass@host:port/dbname',
        ],
        'redis'=>[
            'class' => 'yii\redis\Connection',
            'hostname' => '',
            'port' => 6380,
            'database' => 0,
            'password' => ''
        ],
        'user' => [
            'class' => 'yii\web\User',
            'identityClass' => 'api\models\UserModel',
        ],
        'request' => [
            'parsers' => [
                'application/json' => 'yii\web\JsonParser',
                'text/json' => 'yii\web\JsonParser',
            ]
        ],
        'session' => [
            // this is the name of the session cookie used for login on the backend
            'name' => 'ipa-session',
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'common\logs\mongo\MongoTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'errorHandler' => [
            'class' => 'api\controllers\ErrorController',
        ],
    ],

    'params' => $params,
];
